<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>数值扩展</title>
	</head>
	<body>
		<script>
			// Number.EPSILON 表示JavaScript的最小精度
			function equal(a,b) {
				return Math.abs(a-b) < Number.EPSILON;
			}
			console.log(0.1+0.2 === 0.3);
			console.log(equal(0.1+0.2,0.3));
			
			// 1.二进制、八进制、十进制和十六进制
			let b = 0b1010;
			let o = 0o777;
			let d = 100;
			let x = 0xff;
			console.log(b);
			console.log(o);
			console.log(d);
			console.log(x);
			// 2.Number.isFinite 检测一个数值是否为有限数
			console.log(Number.isFinite(100));
			console.log(Number.isFinite(10/0));
			console.log(Number.isFinite(Infinity));
			// 3.Number.isNaN 检测一个数值是否为NaN
			console.log(Number.isNaN(33));
			// 4.Number.parseInt Number.parseFloat 
			console.log(Number.parseInt('323sdsdasdas'));
			console.log(Number.parseFloat('34.3545345rtrter'));
			// 5.Number.isInteger
			console.log(Number.isInteger(5));
			console.log(Number.isInteger(5.1));
			// 6.Math.trunc 将小数部分抹掉
			console.log(Math.trunc(5.5));
			// 7.Math.sign 判断一个数到底为正数 负数 还是零
			console.log(Math.sign(100));
			console.log(Math.sign(0));
			console.log(Math.sign(-100));
		</script>
	</body>
</html>